package com.appforged.AppForged;

import com.appforged.AppForged1.R;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.view.View;

public class AppForged extends View {

	Bitmap Ball;
	float changingY;
	Typeface font;

	public AppForged(Context context) {
		super(context);
		Ball = BitmapFactory.decodeResource(getResources(), R.drawable.ball);
		changingY = 0;
		font = Typeface.createFromAsset(context.getAssets(), "color basic.ttf");
	}

	@Override
	protected void onDraw(Canvas canvas) {
		// TODO Auto-generated method stub
		super.onDraw(canvas);
		canvas.drawColor(Color.WHITE);
		Paint textPaint = new Paint();
		textPaint.setARGB(50, 100, 149, 237);
		textPaint.setTextAlign(Align.CENTER);
		textPaint.setTextSize(50);
		textPaint.setTypeface(font);
		
		canvas.drawText("SimplyApp", canvas.getWidth()/2, 200, textPaint);
		
		canvas.drawBitmap(Ball, (canvas.getWidth()/2), changingY, null);
		if(changingY < canvas.getHeight()){
			changingY += 10;
			
		}else {
			changingY = 0;
			
		}
		Rect middleRect = new Rect();
		middleRect.set(0, 400, canvas.getWidth(), 550);
		Paint ourBlack = new Paint();
		ourBlack.setColor(Color.BLACK);
		canvas.drawRect(middleRect, ourBlack);
		invalidate();
	}

}
